package com.javawork.igossip;

import java.util.List;
import java.util.Map;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;

public class MultiColorRowAdapter extends SimpleAdapter {

	public int[] colors;

	public MultiColorRowAdapter(Context context,
			List<? extends Map<String, ?>> data, int resource, String[] from,
			int[] to, int[] colors) {
		super(context, data, resource, from, to);
		this.colors = colors;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = super.getView(position, convertView, parent);
		int rowx = position % colors.length;
		v.setBackgroundColor(colors[rowx]);
		return v;
	}

}
